<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xml:lang="en" lang="en">
<head>
    <title>My Facelets Page</title>
    <meta http-equiv="keywords" content="enter,your,keywords,here"/>
    <meta http-equiv="description"
          content="A short description of this page."/>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>

    <!--<link rel="stylesheet" type="text/css" href="styles.css">-->
</head>
<body>
<ui:composition template="BackGeneral.xhtml">
    <ui:define name="content">
        <h:form>
            <ui:include src="/AjaxStatus2.xhtml"/>

            <div style="text-align: left; margin: 10px 0px 0px 0px; width: 98%;">
                <div>
                    <h:outputText id="outputText1" styleClass="tit"
                                  value="－管理员设置－"/>
                    <h:outputLink id="addCasus" rendered="#{adminSessionBean.ifSuper}"
                                  value="#{applicationBean.path}/m/AAAdmin.jspx">
                        <h:outputText value="添加新用户"/>
                    </h:outputLink>
                </div>
                <p:separator/>
                <p:outputPanel autoUpdate="true">
                    <h:messages></h:messages>
                </p:outputPanel>

                <div>
                    <p:dataTable paginator="true" paginatorPosition="bottom" value="#{listAdmin.userList}" var="us"
                                 id="dataTable1"
                                 styleClass="list" rowIndexVar="row" style="width:100%">
                        <p:column>
                            <h:outputText value="#{row+1}"/>
                            <f:facet name="header">
                                <h:outputText value="序号"/>
                            </f:facet>
                        </p:column>
                        <p:column>
                            <h:outputText value="#{us.urn}"/>
                            <f:facet name="header">
                                <h:outputText value="用户名"/>
                            </f:facet>
                        </p:column>
                        <p:column>
                            <h:outputText value="#{us.nickname}"/>
                            <f:facet name="header">
                                <h:outputText value="称呼"/>
                            </f:facet>
                        </p:column>
                        <p:column>
                            <h:outputText value="#{aAAdmin.mapTemp[us.grp]}"/>
                            <f:facet name="header">
                                <h:outputText value="用户组"/>
                            </f:facet>
                        </p:column>
                        <p:column>
                            <h:outputText value="#{us.enabled?'是':'否'}"/>
                            <f:facet name="header">
                                <h:outputText value="激活？"/>
                            </f:facet>
                        </p:column>
                        <p:column>
                            <h:outputText value="#{us.ltime}">
                                <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"
                                                   timeZone="GMT+8"/>
                            </h:outputText>
                            <f:facet name="header">
                                <h:outputText value="上次登录时间"/>
                            </f:facet>
                        </p:column>
                        <p:column>
                            <h:outputLink value="AAAdmin.jspx?id=#{us.id}">
                                <h:outputText value="修改"/>
                            </h:outputLink>
                            <f:facet name="header">
                                <h:outputText value="修改"/>
                            </f:facet>
                        </p:column>
                        <p:column rendered="#{adminSessionBean.ifSuper}">
                            <p:commandLink action="#{listAdmin.delete(us.id)}" update="@form"
                                           onclick="if (!confirm('确认要删除此管理员吗？')) return false">

                                <h:outputText value="删除"/>
                            </p:commandLink>
                            <f:facet name="header">
                                <h:outputText value="删除"/>
                            </f:facet>
                        </p:column>
                    </p:dataTable>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
</body>
</html>
